<script>
	import {
		mapGetters,
		mapActions
	} from 'vuex'
	import config from '@/admin.config.js'
	import { version } from './package.json'
	export default {
		computed: {
			...mapGetters({
				isTokenValid: 'user/isTokenValid'
			})
		},
		methods: {
			...mapActions({
				init: 'app/init'
			})
		},
		onPageNotFound(msg) {
			uni.redirectTo({
				url: config.error.url
			})
		},
		onLaunch: function() {
			// this.$http.Post("admin/images/del", {
			// }, "加载中...")
			console.log(
			        `%c uniCloud Admin %c 当前版本号 v${version} %c`,
			        'background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px;  color: #fff',
			        'background:#007aff ;padding: 1px; border-radius: 0 3px 3px 0;  color: #fff; font-weight: bold;',
			        'background:transparent'
			      )
			console.log('App Launch')
			if (!this.isTokenValid) {
				uni.redirectTo({
					url: config.login.url
				})
			} else {
				this.init()
			}
			
			
		},
		onShow: function() {
			console.log('App Show')
		},
		onHide: function() {
			console.log('App Hide')
		}
	}
</script>

<style lang="scss">
	@import '@/static/css/uni.css';
	@import "@/static/css/index.scss";
	@import "@/static/css/tech-theme.scss";

	/* 全局科技风背景 */
	page {
		background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0f1729 100%);
		min-height: 100vh;
	}

	body {
		background: linear-gradient(135deg, #0a0e27 0%, #1a1f3a 50%, #0f1729 100%);
		color: #e0e6ed;
		font-family: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
	}

	#app {
		background: transparent;
	}
</style>
